<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>出错了 - 归物</title>

    <!-- 网站图标 -->
    <link rel="icon" type="image/png" href="/icon.png">
    <link rel="shortcut icon" type="image/png" href="/icon.png">
    <link rel="apple-touch-icon" href="/icon.png">

    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
    <style>
        .error-container {
            min-height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        }
        .error-card {
            background: white;
            border-radius: 15px;
            box-shadow: 0 10px 30px rgba(0,0,0,0.2);
            padding: 2rem;
            text-align: center;
            max-width: 500px;
            width: 90%;
        }
        .error-icon {
            font-size: 4rem;
            color: #dc3545;
            margin-bottom: 1rem;
        }
        .error-title {
            color: #333;
            margin-bottom: 1rem;
        }
        .error-message {
            color: #666;
            margin-bottom: 2rem;
        }
    </style>
</head>
<body>
    <div class="error-container">
        <div class="error-card">
            <i class="fas fa-exclamation-triangle error-icon"></i>
            <h2 class="error-title">出错了</h2>
            <p class="error-message">
                <span th:if="${errorMessage}" th:text="${errorMessage}">抱歉，系统遇到了一个错误。请稍后重试，或联系管理员。</span>
                <span th:unless="${errorMessage}">抱歉，系统遇到了一个错误。请稍后重试，或联系管理员。</span>
            </p>
            <div class="d-grid gap-2">
                <a href="/login" class="btn btn-primary">
                    <i class="fas fa-home"></i> 返回首页
                </a>
                <button onclick="history.back()" class="btn btn-outline-secondary">
                    <i class="fas fa-arrow-left"></i> 返回上页
                </button>
            </div>
            
            <!-- 调试信息（仅在开发环境显示） -->
            <div th:if="${exception}" class="mt-3 text-start">
                <details>
                    <summary class="text-muted">错误详情</summary>
                    <div class="mt-2 p-2 bg-light rounded">
                        <small class="text-muted">
                            <strong>错误类型:</strong> <span th:text="${exception.class.simpleName}">Exception</span><br>
                            <strong>错误信息:</strong> <span th:text="${exception.message}">Error message</span><br>
                            <strong>请求URL:</strong> <span th:text="${url}">URL</span><br>
                            <strong>时间戳:</strong> <span th:text="${#dates.format(new java.util.Date(timestamp), 'yyyy-MM-dd HH:mm:ss')}">Timestamp</span>
                        </small>
                    </div>
                </details>
            </div>
        </div>
    </div>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>
